package dgcptic.interventions;
//  dgcptic.interventions.ServletRealisation
import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dgcptic.interventions.model.Realisateur;
import dgcptic.interventions.model.RealisateurFactory;

public class ServletRealisation extends HttpServlet {

	
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String[] idDemandes = req.getParameterValues("idDemande");
		String nom  = req.getParameter("nom");
		String prenom  = req.getParameter("prenom");
		Realisateur realisateur = new Realisateur();
		realisateur.setId(nom);
		realisateur.setNom(nom);
		realisateur.setPrenom(prenom);
		RealisateurFactory rfactoru = new RealisateurFactory();
		rfactoru.persists(realisateur);
		RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/administrateur.jsp");
		dispatcher.forward(req, resp);
	}

	
	
}
